package com.rdk.filter;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * 过滤器
 * @author wang_lei
 *
 */
public class UserFilter implements Filter {

	protected final static Log logger = LogFactory.getLog(UserFilter.class);	
	@Override
	public void destroy() {
		
	}

	@Override
	public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
		HttpServletRequest request = (HttpServletRequest) req;
		HttpServletResponse response = (HttpServletResponse)res;
	
		String isRerequest = request.getParameter("isRerequest");
		//isRerequest：1    重新通过clientKey请求用户接口
		if(StringUtils.equals(isRerequest, "1")){
			String clientKey = request.getParameter("clientKey");
		}
		
		chain.doFilter(request, response);
		return;
	}
	

	@Override
	public void init(FilterConfig arg0) throws ServletException {
		
	}

}
